<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <global-com></global-com>
    </div>
</body>
<script src="./vue.js"></script>
<script>
    const Childen1={
        template:`
            <div>
                <span>我是子组件1</span>
            </div>
        `,
    }
    const Childen2={
        template:`
            <div>
                <span>我是子组件2</span>
                
            </div>
        `,
    }
    const globalCom={
        template:`
            <div>
                <span ref='c'>我是全局组件</span>
                <childen1 ref='a'></childen1>
                <childen2 ref='b'></childen2>
                <button @click='co'>按钮</button>
            </div>
        `,
        components:{
            Childen1,
            Childen2
        },
        methods:{
            co(){
                console.log(this.$children);
            }
        }
    }
    Vue.component('globalCom',globalCom)
    const vm=new Vue({
        el:'#app'
    })
</script>
</html>